home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
biblio
/
bibtex
/
utils
/
lookbibtex
/
bibdestringify.dist
< prev
next >
Wrap
Text File
|
1993-03-18
|
2KB
|
49 lines
#!/usr/dist/bin/perl
#
# bibdestringify 1.02
# a perl script to remove strings from a bibtex file.
# Comments to <johnh@cs.ucla.edu>.
#
# Copyright (C) 1990 by John Heidemann
# This is distributed under the GNU Public Licence, Version 1 (Feb 89).
# See the Perl documentation for a copy of that license.
#
# Timings (from ./bibdestringify <bibdestringify.example >/dev/null):
# version time (with /bin/time)
# 0.90 14.6 real 13.8 user 0.2 sys
# 0.91 12.6 real 11.9 user 0.2 sys
# 1.0 1.7 real 1.4 user 0.2 sys
#
# 17-Jan-91 It is begun. bibdestringify 0.9
# 15-Feb-91 It is documented, and given out to khera@cs.duke.edu.
# 26-Aug-91 Speed slightly improved. bibdestringify 0.91
# 26-Aug-91 Changed to remember patterns and process with eval.
# Speed dramatically (order of magnitude) improved.
# My hat is off to the mighty eval! bibdestringify 1.0
# 27-Aug-91 Patched to allow a more liberal definition of @strings
# at the suggestion of Vick Khera <khera@cs.duke.edu>. bibdestringify 1.01
# 11-Sep-91 A positivly radical definition of @strings. bibdestringify 1.02
#
$replace = 's/\"\s*\#\s*\"//g;'; # the replacement pattern
# (default to doing string concatination)
while (<STDIN>) {
if (($name,$value) = /\@string\s*{\s*(\S+)\s*=\s*(.*)\s*}/) {
$name =~ s/(\W)/\\\1/g; # quote special chars
$value =~ s/(\W)/\\\1/g;
$replace = "s/\\b$name\\b/$value/g;\n" . $replace;
} else {
# if (!$done) { print "$replace\n"; $done=1; };
eval $replace;
$@ && die ("Error in eval, $@");
print $_;
};
};